<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .fuqin{
      width: 200px;
      height: 100px;
      border: 1px solid #00f;
      background-color: #66ccff;
    }
    .erzi{
      width: 100px;
      height: 100px;
      margin: 0 auto;   /* 居中 */
      background-color: #f00;
    }

    .father{
      position: relative;
      width: 200px;
      height: 100px;
      border: 1px solid #00f;
      margin-top: 50px;
      background-color: #66ccff;
    }
    .son{
      position: absolute;  
      left: 50%;  /* 绝对定位居中 */
      transform: translateX(-50%); /* 位移 */
      width: 100px;
      height: 100px;
      background-color: #0f0;
    }

    .big{
      position: relative;
      width: 200px;
      height: 100px;
      border: 1px solid #00f;
      margin-top: 50px;
      background-color: #66ccff;
    }
    .small{
      position: absolute;  
      left: 50%;  /* 绝对定位居中 */
      margin-left: -50px; /* 计算宽度 */
      width: 100px;
      height: 100px;
      background-color: #ff0;
    }
  </style>
</head>
<body>
  <!-- 1 -->
  <div class="fuqin">
    <div class="erzi"></div>
  </div>
  <!-- 2 -->
  <div class="father">
    <div class="son"></div>
  </div>
  <!-- 3 -->
  <div class="big">
    <div class="small"></div>
  </div>
</body>
</html>